{literal}
<h2>Constructor</h2>

Constructor:
<pre class="code">
&lt;?php
class MyClass extends DomArObject {
	/**
	* @orm text
	*/
	public $name;
	
	public function construct() {
		
	}
}
?&gt;
</pre>
You can't give arguments to constructor!<br>

<h2>Init</h2>

Init method is useful if you want to make some code only run for new objects. (Objects that are not yet saved.)
<pre class="code">
&lt;?php
class MyClass extends DomArObject {
	
	public function init() {
		echo 'Called init';
	}

}

$a = new MyClass(); // Outputs "Called init"
$a = MyClass::load( SOME_ID ); // Outputs nothing.
?&gt;
</pre>

<h2>initLoaded</h2>
InitLoaded method is useful if you want to make some code only run for saved objects that are just loaded from database.
<pre class="code">
&lt;?php
class MyClass extends DomArObject {
	
	public function initLoaded() {
		echo 'Called initLoaded';
	}

}

$a = new MyClass(); // Outputs nothing
$a = MyClass::load( SOME_ID ); // Outputs "initLoaded".
?&gt;
</pre>



<h2>Accessing record properties</h2>
You can set record property to public, protected and private. This will not give you default behaviour of these but almost.<br>
Notice that record properties are only these properties which are have @orm tag.<br>
See this table for explanations:<br>
<table cellspacing="3" cellpadding="2" border="1">
	<colgroup>
		<col width="100">
		<col width="140">
		<col width="140">
		<col width="140">
	</colgroup>
	<tr>
		<td></td>
		<th>Class</th>
		<th>Extending class</th>
		<th>Otside</th>
	</tr>
	<tr>
		<th>Public</th>
		<td>get, set</td>
		<td>get, set</td>
		<td>get, set</td>
	</tr>
	<tr>
		<th>Protected</th>
		<td>get, set</td>
		<td>get, set</td>
		<td>get</td>
	</tr>
	<tr>
		<th>Private</th>
		<td>get, set</td>
		<td>get</td>
		<td>get</td>
	</tr>
</table>
Get means that you can access property value. ($value = $a->property)<br>
Set means that you can change property value. ($a->property = "some new value")<br>

<h2>Record methods</h2>
If you wan't to create method that can access record values directly (Not through DomAr setters and getters) you can add @orm access tag to method.
<pre class="code">
&lt;?php
class MyClass extends DomArObject {
	/**
	* @orm text
	*/
	public $text;
	
	/**
	* @orm access
	*/
	public function recordMethod() {
		$this->text = 10; // this would normally fail, but as this method can access record properties directly it is allowed.		
	}
}
?&gt;
</pre>
Same thing can be done using this:
<pre class="code">
&lt;?php
class MyClass extends DomArObject {
	/**
	* @orm text
	*/
	public $text;
	
	public function recordMethod() {
		$this->forceSet('text', 10);		
	}
}
?&gt;
</pre>
{/literal}